#!/usr/bin/env sh

set -e

cd "simpleCodingQuiz-${BUILD_NUMBER}"

git checkout $branch

../echoMessage.sh  "正在生成模版仓库，"

git config --global user.email "linwenjun@163.com"
git config --global user.name "linwenjun"

REPO_URL="github.com/recruiting-system/$coding_name-$TIME_STRING.git"

curl -i \
    -u "recruiting-system:${github_token}" https://api.github.com/user/repos \
    -d '{"name":"'"$coding_name-$TIME_STRING"'"}'

rm -fr .git

git init
git add .
git commit -m 'first commit'
git push -u https://$github_cert@$REPO_URL master
../echoMessage.sh  "新建模版仓库地址是 $REPO_URL。"

curl -X PUT  \
    -d templateRepository=https://${REPO_URL} \
    $callback_url/templateRepository



